/*
 * JniHFileMethodComment.java  0.4.0 / Nov 6, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
package com.cute4j.tools.ng.jni;

import java.io.IOException;
import java.io.PrintWriter;

import com.thoughtworks.qdox.model.JavaMethod;

import com.cute4j.tools.ng.AbstractNativeFile;
import com.cute4j.tools.ng.NativeFileText;
import com.cute4j.tools.ng.Utils;

/**
 * Comment of the JNI Header File Method.
 *
 * @author Slobodan Vrkacevic
 * @version 0.4.0
 */
public class JniHFileMethodComment extends NativeFileText {

// Private Fields. -------------------------------------------------------------

  private JavaMethod javaMethod;

// Public Constructors. --------------------------------------------------------

  /**
   * Constructs new JniHFileMethodComment object.
   *
   * @param nativeFile the native file
   * @param javaMethod the java method
   */
  public JniHFileMethodComment(AbstractNativeFile nativeFile,
                               JavaMethod javaMethod) {
    super(nativeFile);
    this.javaMethod = javaMethod;
  }

  /**
   * Constructs new JniHFileMethodComment object.
   *
   * @param nativeFile the native file
   * @param content header's content
   */
  public JniHFileMethodComment(AbstractNativeFile nativeFile, String content) {
    super(nativeFile, content);
  }

// Overridden Methods. ---------------------------------------------------------

  /**
   * {@inheritDoc}
   */
  protected void storeContent(PrintWriter pw) throws IOException {
    pw.println("/*");
    pw.print(" * Class:     ");
    pw.println(Utils.getMangledClassName(javaMethod.getParentClass()));
    pw.print(" * Method:    ");
    pw.println(javaMethod.getName());
    pw.print(" * Signature: ");
    pw.println(Utils.getSignature(javaMethod));
    pw.println(" */");
  }

}
